package com.zhijiaoyun.common;

/**
 * @author shisfish
 * @date 2017/6/6
 */
public class DsConstant {

	public static final int PAGESIZE_DEFAULT = 10;
	
	public static final int LIMIT_PAGE_SIZE = 5;

	public static final int PAGESIZE_FOUR = 4;
	
	public static final int PAGE_SIZE_12 = 12;

	public static final int RECOMMEND_LIMIT_SIZE = 4;

	public static final String CODE = "code";
	public static final String MESSAGE = "message";

	public static final String EXCEL_TYPE_USER = "user";


	public static final String EMAIL = "email";

	public static final String FORGET_PASSWORD = "forgetPassword";

	// 后面改成200吧
	public static final String MESSAGE_SUCCESS = "操作成功";
	public static final int CODE_SUCCESS = 0;

	// 后面修改
	public static final String MESSAGE_TOKEN_LOST = "token过期";
	public static final int CODE_TOKEN_LOST = 1;

	// 后面修改
	public static final String MESSAGE_AUTHORITY_LOST = "无权限";
	public static final int CODE_AUTHORITY_LOST = 2;

	// 后面修改
	public static final String MESSAGE_LOGIN_ERROR = "用户名或密码错误";
	public static final int CODE_LOGIN_ERROR = 3;

	// 后面修改
	public static final String MESSAGE_OLD_PASSWORD_ERROR = "原密码错误";
	public static final int CODE_OLD_PASSWORD_ERROR = 4;

	// 后面修改
	public static final String MESSAGE_LINK_LOST = "链接失效";
	public static final int CODE_LINK_LOST = 5;

	public static final int CODE_BUY_NOTYET = 2000;
	public static final String MESSAGE_BUY_NOTYET = "未购买";

	public static final int CODE_PICTURE_NOT_NULL = 3000;
	public static final String MESSAGE_PICTURE_NOT_NULL = "图片不能为空";

	public static final int CODE_OBJECT_LOST = 4000;
	public static final String MESSAGE_OBJECT_LOST = "对象不存在";
	public static final int CODE_USER_LOST = 4001; 
	public static final String MESSAGE_USER_LOST = "用户不存在";
	public static final int CODE_COURSE_LOST = 4002; 
	public static final String MESSAGE_COURSE_LOST = "课程不存在"; 
	public static final int CODE_LESSON_LOST = 4003; 
	public static final String MESSAGE_LESSON_LOST = "课时不存在"; 
	public static final int CODE_NEWS_LOST = 4004; 
	public static final String MESSAGE_NEWS_LOST = "资讯不存在"; 
	public static final int CODE_ADMIN_LOST = 4005; 
	public static final String MESSAGE_ADMIN_LOST = "管理员不存在"; 
	public static final int CODE_COURSE_CATEGORY_LOST = 4006;
	public static final String MESSAGE_COURSE_CATEGORY_LOST = "分类不存在";
	public static final int CODE_BANNER_LOST = 4007;
	public static final String MESSAGE_BANNER_LOST = "轮播图不存在";
	
	public static final int CODE_USERNAME_EXIST = 5000;
	public static final String MESSAGE_USERNAME_EXIST = "用户名已存在";
	public static final int CODE_COURSE_NAME_EXIST = 5001;
	public static final String MESSAGE_COURSE_NAME_EXIST = "课程名已存在";
	public static final int CODE_LESSON_NAME_EXIST = 5002;
	public static final String MESSAGE_LESSON_NAME_EXIST = "课时名已存在";
	public static final int CODE_NEWS_NAME_EXIST = 5003;
	public static final String MESSAGE_NEWS_NAME_EXIST = "资讯标题已存在";
	public static final int CODE_COURSE_CATEGORY_NAME_EXIST = 5004;
	public static final String MESSAGE_COURSE_CATEGORY_NAME_EXIST = "分类名已存在";
	public static final int CODE_EMAIL_EXIST = 5005;
	public static final String MESSAGE_EMAIL_EXIST = "邮箱已存在";
	public static final int CODE_ADMIN_ACCOUNT_EXIST = 5006;
	public static final String MESSAGE_ADMIN_ACCOUNT_EXIST = "管理员账号已存在";
	public static final int CODE_SHOPPING_CART_EXIST = 5007;
	public static final String MESSAGE_SHOPPING_CART_EXIST = "改课程在购物车中已存在";
	
	public static final int CODE_EMAIL_SEND_ERROR = 6000;
	public static final String MESSAGE_EMAIL_SEND_ERROR = "邮箱发送失败";
	public static final int CODE_COURSE_DELETE_ERROR_1 = 6001;
	public static final String MESSAGE_COURSE_DELETE_ERROR_1 = "该课程已有人购买，不能删除";
	public static final int CODE_COURSE_DELETE_ERROR_2 = 6002;
	public static final String MESSAGE_COURSE_DELETE_ERROR_2 = "有课时，先删除课时在删除课程";
	public static final int CODE_PICTURE_UPLOAD_ERROR = 6003;
	public static final String MESSAGE_PICTURE_UPLOAD_ERROR = "图片上传失败";
	public static final int CODE_ORDER_COMPLETE_ERROR = 6004;
	public static final String MESSAGE_ORDER_COMPLETE_ERROR = "订单已完成，不能取消";
	public static final int CODE_ADD_SHOPPING_CART_ORDER_ERROR = 6005;
	public static final String MESSAGE_ADD_SHOPPING_CART_ORDER_ERROR = "课程已在订单中，不能添加到购物车";
	
	
	
	public static final String SHOW_MODEL = "1,2,3,4";

//	static {
//		JsonParser parse = new JsonParser(); // 创建json解析器
//		JsonObject json;
//		String permissionStr = "";
//		try {
//			InputStream is = CommonUtils.class.getClassLoader().getResourceAsStream("permission.json");
//			BufferedReader reader = new BufferedReader(new InputStreamReader(is));
//			String line = "";
//			StringBuffer sb = new StringBuffer();
//			try {
//				while ((line = reader.readLine()) != null) {
//					sb.append(line);
//				}
//			} catch (IOException e) {
//				e.printStackTrace();
//			}
//			json = (JsonObject) parse.parse(sb.toString());
//			JsonObject permission = json.get("permission").getAsJsonObject();
//			boolean perManual = permission.get("数据录入").getAsBoolean();
//			boolean perAutomatic = permission.get("数据采集").getAsBoolean();
//			boolean perStatistics = permission.get("数据统计").getAsBoolean();
//			boolean perSetting = permission.get("系统管理").getAsBoolean();
//			if (perManual)
//				permissionStr += ",1";
//			if (perAutomatic)
//				permissionStr += ",2";
//			if (perStatistics)
//				permissionStr += ",3";
//			if (perSetting)
//				permissionStr += ",4";
//		} catch (JsonIOException e) {
//			e.printStackTrace();
//		} catch (JsonSyntaxException e) {
//			e.printStackTrace();
//		}
//		if (!"".equals(permissionStr) && permissionStr.length() > 1)
//			SHOW_MODEL = permissionStr.substring(1);
//		else
//			SHOW_MODEL = "1,2,3,4";
//	}

}
